home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 76 / DVD Actual 1 Marzo 2003.iso / Trial / TurboCAD 7.1 Pro / Data.Cab / F25292_matrix.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-11-10  |  27.3 KB  |  888 lines

  1. VERSION 5.00
  2. Begin VB.Form MatrixForm 
  3.    Caption         =   "Matrix Object Sample"
  4.    ClientHeight    =   7065
  5.    ClientLeft      =   2370
  6.    ClientTop       =   735
  7.    ClientWidth     =   7350
  8.    LinkTopic       =   "Form1"
  9.    MaxButton       =   0   'False
  10.    MinButton       =   0   'False
  11.    ScaleHeight     =   7065
  12.    ScaleWidth      =   7350
  13.    Begin VB.CommandButton btExit 
  14.       Caption         =   "Exit"
  15.       Height          =   492
  16.       Left            =   120
  17.       TabIndex        =   60
  18.       Top             =   6480
  19.       Width           =   7092
  20.    End
  21.    Begin VB.Frame Frame6 
  22.       Appearance      =   0  'Flat
  23.       BackColor       =   &H8000000A&
  24.       Caption         =   "Matrix Transformations :"
  25.       ForeColor       =   &H80000008&
  26.       Height          =   4212
  27.       Left            =   3360
  28.       TabIndex        =   30
  29.       Top             =   2160
  30.       Width           =   3852
  31.       Begin VB.CommandButton btScaleAndRotate 
  32.          Caption         =   "TranslateScaleAndRotate"
  33.          Height          =   372
  34.          Left            =   120
  35.          TabIndex        =   58
  36.          ToolTipText     =   "Use Rotate, Scale, Angle, Vertex "
  37.          Top             =   3600
  38.          Width           =   3612
  39.       End
  40.       Begin VB.CommandButton Translate 
  41.          Caption         =   "Translate"
  42.          Height          =   372
  43.          Index           =   5
  44.          Left            =   1320
  45.          TabIndex        =   57
  46.          ToolTipText     =   "Use Vertex, Bool flag"
  47.          Top             =   3000
  48.          Width           =   1092
  49.       End
  50.       Begin VB.CommandButton Scale 
  51.          Caption         =   "Scale"
  52.          Height          =   372
  53.          Index           =   4
  54.          Left            =   2520
  55.          TabIndex        =   56
  56.          ToolTipText     =   "Use Scale, Vertex, Bool flag"
  57.          Top             =   3000
  58.          Width           =   1212
  59.       End
  60.       Begin VB.CommandButton Rotate 
  61.          Caption         =   "Rotate"
  62.          Height          =   372
  63.          Index           =   3
  64.          Left            =   120
  65.          TabIndex        =   55
  66.          ToolTipText     =   "Use Rotate, Angle, Vertex, Bool Flag"
  67.          Top             =   3000
  68.          Width           =   1092
  69.       End
  70.       Begin VB.TextBox valFlag 
  71.          Height          =   288
  72.          Left            =   1680
  73.          TabIndex        =   49
  74.          Top             =   2280
  75.          Width           =   612
  76.       End
  77.       Begin VB.TextBox valAngle 
  78.          Height          =   288
  79.          Left            =   1680
  80.          TabIndex        =   48
  81.          Top             =   1920
  82.          Width           =   612
  83.       End
  84.       Begin VB.TextBox valRotZ 
  85.          Height          =   288
  86.          Left            =   3120
  87.          TabIndex        =   43
  88.          Top             =   1440
  89.          Width           =   612
  90.       End
  91.       Begin VB.TextBox valRotY 
  92.          Height          =   288
  93.          Left            =   2400
  94.          TabIndex        =   42
  95.          Top             =   1440
  96.          Width           =   612
  97.       End
  98.       Begin VB.TextBox valRotX 
  99.          Height          =   288
  100.          Left            =   1680
  101.          TabIndex        =   41
  102.          Top             =   1440
  103.          Width           =   612
  104.       End
  105.       Begin VB.TextBox valScaleZ 
  106.          Height          =   288
  107.          Left            =   3120
  108.          TabIndex        =   40
  109.          Top             =   1080
  110.          Width           =   612
  111.       End
  112.       Begin VB.TextBox valScaleY 
  113.          Height          =   288
  114.          Left            =   2400
  115.          TabIndex        =   39
  116.          Top             =   1080
  117.          Width           =   612
  118.       End
  119.       Begin VB.TextBox valScaleX 
  120.          Height          =   288
  121.          Left            =   1680
  122.          TabIndex        =   38
  123.          Top             =   1080
  124.          Width           =   612
  125.       End
  126.       Begin VB.TextBox valVertexZ 
  127.          Height          =   288
  128.          Left            =   3120
  129.          TabIndex        =   33
  130.          Top             =   720
  131.          Width           =   612
  132.       End
  133.       Begin VB.TextBox valVertexY 
  134.          Height          =   288
  135.          Left            =   2400
  136.          TabIndex        =   32
  137.          Top             =   720
  138.          Width           =   612
  139.       End
  140.       Begin VB.TextBox valVertexX 
  141.          Height          =   288
  142.          Left            =   1680
  143.          TabIndex        =   31
  144.          Top             =   720
  145.          Width           =   612
  146.       End
  147.       Begin VB.Line Line6 
  148.          BorderColor     =   &H80000006&
  149.          X1              =   0
  150.          X2              =   3960
  151.          Y1              =   2760
  152.          Y2              =   2760
  153.       End
  154.       Begin VB.Label Label6 
  155.          Caption         =   "Parameters :"
  156.          Height          =   252
  157.          Left            =   120
  158.          TabIndex        =   51
  159.          Top             =   240
  160.          Width           =   1332
  161.       End
  162.       Begin VB.Label Label5 
  163.          Caption         =   "Bool flag :"
  164.          Height          =   252
  165.          Left            =   120
  166.          TabIndex        =   50
  167.          Top             =   2280
  168.          Width           =   1332
  169.       End
  170.       Begin VB.Label Label4 
  171.          Caption         =   "Angle :"
  172.          Height          =   252
  173.          Left            =   120
  174.          TabIndex        =   47
  175.          Top             =   1920
  176.          Width           =   1332
  177.       End
  178.       Begin VB.Line Line4 
  179.          BorderColor     =   &H80000006&
  180.          X1              =   1560
  181.          X2              =   3840
  182.          Y1              =   1800
  183.          Y2              =   1800
  184.       End
  185.       Begin VB.Label Label3 
  186.          Caption         =   "Rotate :"
  187.          Height          =   252
  188.          Left            =   120
  189.          TabIndex        =   46
  190.          Top             =   1440
  191.          Width           =   1332
  192.       End
  193.       Begin VB.Label Label2 
  194.          Caption         =   "Scale :"
  195.          Height          =   252
  196.          Index           =   1
  197.          Left            =   120
  198.          TabIndex        =   45
  199.          Top             =   1080
  200.          Width           =   1332
  201.       End
  202.       Begin VB.Label Label2 
  203.          Caption         =   "Vertex :"
  204.          Height          =   252
  205.          Index           =   0
  206.          Left            =   120
  207.          TabIndex        =   44
  208.          Top             =   720
  209.          Width           =   1332
  210.       End
  211.       Begin VB.Line Line3 
  212.          BorderColor     =   &H80000006&
  213.          X1              =   1560
  214.          X2              =   1560
  215.          Y1              =   240
  216.          Y2              =   2760
  217.       End
  218.       Begin VB.Line Line2 
  219.          BorderColor     =   &H80000006&
  220.          X1              =   0
  221.          X2              =   3840
  222.          Y1              =   600
  223.          Y2              =   600
  224.       End
  225.       Begin VB.Label Label1 
  226.          Alignment       =   2  'Center
  227.          Caption         =   "Z"
  228.          Height          =   252
  229.          Index           =   2
  230.          Left            =   3120
  231.          TabIndex        =   36
  232.          Top             =   240
  233.          Width           =   612
  234.       End
  235.       Begin VB.Label Label1 
  236.          Alignment       =   2  'Center
  237.          Caption         =   "Y"
  238.          Height          =   252
  239.          Index           =   1
  240.          Left            =   2400
  241.          TabIndex        =   35
  242.          Top             =   240
  243.          Width           =   612
  244.       End
  245.       Begin VB.Label Label1 
  246.          Alignment       =   2  'Center
  247.          Caption         =   "X"
  248.          Height          =   252
  249.          Index           =   0
  250.          Left            =   1680
  251.          TabIndex        =   34
  252.          Top             =   240
  253.          Width           =   612
  254.       End
  255.    End
  256.    Begin VB.Frame Frame5 
  257.       Appearance      =   0  'Flat
  258.       BackColor       =   &H8000000A&
  259.       Caption         =   "Matrix's set"
  260.       ForeColor       =   &H80000008&
  261.       Height          =   4212
  262.       Left            =   120
  263.       TabIndex        =   11
  264.       Top             =   2160
  265.       Width           =   3012
  266.       Begin VB.CommandButton Transpose 
  267.          Caption         =   "Transpose"
  268.          Height          =   372
  269.          Index           =   0
  270.          Left            =   120
  271.          TabIndex        =   54
  272.          Top             =   3720
  273.          Width           =   2772
  274.       End
  275.       Begin VB.CommandButton Invert 
  276.          Caption         =   "Invert"
  277.          Height          =   372
  278.          Index           =   0
  279.          Left            =   1560
  280.          TabIndex        =   53
  281.          Top             =   3240
  282.          Width           =   1332
  283.       End
  284.       Begin VB.CommandButton Identity 
  285.          Caption         =   "Identity"
  286.          Height          =   372
  287.          Index           =   1
  288.          Left            =   120
  289.          TabIndex        =   52
  290.          Top             =   3240
  291.          Width           =   1332
  292.       End
  293.       Begin VB.ComboBox cbMatrix 
  294.          Height          =   288
  295.          Left            =   120
  296.          TabIndex        =   37
  297.          Top             =   2280
  298.          Width           =   2772
  299.       End
  300.       Begin VB.CommandButton btSet 
  301.          Caption         =   "Set"
  302.          Height          =   372
  303.          Left            =   120
  304.          TabIndex        =   29
  305.          Top             =   2760
  306.          Width           =   1332
  307.       End
  308.       Begin VB.CommandButton btGet 
  309.          Caption         =   "Get"
  310.          Height          =   372
  311.          Left            =   1560
  312.          TabIndex        =   28
  313.          Top             =   2760
  314.          Width           =   1332
  315.       End
  316.       Begin VB.TextBox matrix_33 
  317.          Height          =   288
  318.          Left            =   2280
  319.          TabIndex        =   27
  320.          Top             =   1800
  321.          Width           =   612
  322.       End
  323.       Begin VB.TextBox matrix_32 
  324.          Height          =   288
  325.          Left            =   1560
  326.          TabIndex        =   26
  327.          Top             =   1800
  328.          Width           =   612
  329.       End
  330.       Begin VB.TextBox matrix_31 
  331.          Height          =   288
  332.          Left            =   840
  333.          TabIndex        =   25
  334.          Top             =   1800
  335.          Width           =   612
  336.       End
  337.       Begin VB.TextBox matrix_30 
  338.          Height          =   288
  339.          Left            =   120
  340.          TabIndex        =   24
  341.          Top             =   1800
  342.          Width           =   612
  343.       End
  344.       Begin VB.TextBox matrix_23 
  345.          Height          =   288
  346.          Left            =   2280
  347.          TabIndex        =   23
  348.          Top             =   1440
  349.          Width           =   612
  350.       End
  351.       Begin VB.TextBox matrix_22 
  352.          Height          =   288
  353.          Left            =   1560
  354.          TabIndex        =   22
  355.          Top             =   1440
  356.          Width           =   612
  357.       End
  358.       Begin VB.TextBox matrix_21 
  359.          Height          =   288
  360.          Left            =   840
  361.          TabIndex        =   21
  362.          Top             =   1440
  363.          Width           =   612
  364.       End
  365.       Begin VB.TextBox matrix_20 
  366.          Height          =   288
  367.          Left            =   120
  368.          TabIndex        =   20
  369.          Top             =   1440
  370.          Width           =   612
  371.       End
  372.       Begin VB.TextBox matrix_13 
  373.          Height          =   288
  374.          Left            =   2280
  375.          TabIndex        =   19
  376.          Top             =   1080
  377.          Width           =   612
  378.       End
  379.       Begin VB.TextBox matrix_12 
  380.          Height          =   288
  381.          Left            =   1560
  382.          TabIndex        =   18
  383.          Top             =   1080
  384.          Width           =   612
  385.       End
  386.       Begin VB.TextBox matrix_11 
  387.          Height          =   288
  388.          Left            =   840
  389.          TabIndex        =   17
  390.          Top             =   1080
  391.          Width           =   612
  392.       End
  393.       Begin VB.TextBox matrix_10 
  394.          Height          =   288
  395.          Left            =   120
  396.          TabIndex        =   16
  397.          Top             =   1080
  398.          Width           =   612
  399.       End
  400.       Begin VB.TextBox matrix_03 
  401.          Height          =   288
  402.          Left            =   2280
  403.          TabIndex        =   15
  404.          Top             =   720
  405.          Width           =   612
  406.       End
  407.       Begin VB.TextBox matrix_02 
  408.          Height          =   288
  409.          Left            =   1560
  410.          TabIndex        =   14
  411.          Top             =   720
  412.          Width           =   612
  413.       End
  414.       Begin VB.TextBox matrix_01 
  415.          Height          =   288
  416.          Left            =   840
  417.          TabIndex        =   13
  418.          Top             =   720
  419.          Width           =   612
  420.       End
  421.       Begin VB.TextBox matrix_00 
  422.          Height          =   288
  423.          Left            =   120
  424.          TabIndex        =   12
  425.          Top             =   720
  426.          Width           =   612
  427.       End
  428.       Begin VB.Line Line8 
  429.          BorderColor     =   &H80000006&
  430.          X1              =   3000
  431.          X2              =   0
  432.          Y1              =   600
  433.          Y2              =   600
  434.       End
  435.       Begin VB.Label Label7 
  436.          Alignment       =   2  'Center
  437.          Caption         =   "Contents :"
  438.          Height          =   252
  439.          Left            =   840
  440.          TabIndex        =   59
  441.          Top             =   240
  442.          Width           =   1332
  443.       End
  444.       Begin VB.Line Line1 
  445.          BorderColor     =   &H80000006&
  446.          X1              =   0
  447.          X2              =   3000
  448.          Y1              =   2160
  449.          Y2              =   2160
  450.       End
  451.    End
  452.    Begin VB.Frame Frame3 
  453.       Appearance      =   0  'Flat
  454.       BackColor       =   &H8000000A&
  455.       Caption         =   "Create :"
  456.       ClipControls    =   0   'False
  457.       ForeColor       =   &H80000008&
  458.       Height          =   1932
  459.       Left            =   120
  460.       TabIndex        =   0
  461.       Top             =   120
  462.       Width           =   7092
  463.       Begin VB.Frame Frame2 
  464.          Appearance      =   0  'Flat
  465.          BackColor       =   &H8000000A&
  466.          Caption         =   "Command :"
  467.          ForeColor       =   &H80000008&
  468.          Height          =   1332
  469.          Left            =   3240
  470.          TabIndex        =   3
  471.          Top             =   360
  472.          Width           =   3732
  473.          Begin VB.CommandButton btDuplicate 
  474.             Caption         =   "Duplicate"
  475.             Enabled         =   0   'False
  476.             Height          =   372
  477.             Left            =   1320
  478.             TabIndex        =   10
  479.             Top             =   480
  480.             Width           =   1092
  481.          End
  482.          Begin VB.CommandButton btDelete 
  483.             Caption         =   "Delete"
  484.             Enabled         =   0   'False
  485.             Height          =   372
  486.             Left            =   2520
  487.             TabIndex        =   9
  488.             Top             =   480
  489.             Width           =   1092
  490.          End
  491.          Begin VB.CommandButton btCreate 
  492.             Caption         =   "Create"
  493.             Height          =   372
  494.             Left            =   120
  495.             TabIndex        =   8
  496.             Top             =   480
  497.             Width           =   1092
  498.          End
  499.       End
  500.       Begin VB.Frame Frame1 
  501.          Appearance      =   0  'Flat
  502.          BackColor       =   &H8000000A&
  503.          Caption         =   "Server mode :"
  504.          ForeColor       =   &H80000008&
  505.          Height          =   1332
  506.          Left            =   1560
  507.          TabIndex        =   2
  508.          Top             =   360
  509.          Width           =   1452
  510.          Begin VB.OptionButton optLocal 
  511.             Caption         =   "Local"
  512.             Height          =   252
  513.             Left            =   120
  514.             TabIndex        =   7
  515.             Top             =   840
  516.             Width           =   852
  517.          End
  518.          Begin VB.OptionButton optInproc 
  519.             Caption         =   "In-proc"
  520.             Height          =   252
  521.             Left            =   120
  522.             TabIndex        =   6
  523.             Top             =   360
  524.             Value           =   -1  'True
  525.             Width           =   852
  526.          End
  527.       End
  528.       Begin VB.Frame Frame4 
  529.          Appearance      =   0  'Flat
  530.          BackColor       =   &H8000000A&
  531.          Caption         =   "Object :"
  532.          ClipControls    =   0   'False
  533.          ForeColor       =   &H80000008&
  534.          Height          =   1332
  535.          Left            =   120
  536.          TabIndex        =   1
  537.          Top             =   360
  538.          Width           =   1335
  539.          Begin VB.OptionButton optVertex 
  540.             Caption         =   "Vertex"
  541.             Height          =   252
  542.             Left            =   120
  543.             TabIndex        =   5
  544.             Top             =   840
  545.             Width           =   975
  546.          End
  547.          Begin VB.OptionButton optMatrix 
  548.             Caption         =   "Matrix"
  549.             Height          =   252
  550.             Left            =   120
  551.             TabIndex        =   4
  552.             Top             =   360
  553.             Value           =   -1  'True
  554.             Width           =   732
  555.          End
  556.       End
  557.    End
  558.    Begin VB.Line Line7 
  559.       X1              =   120
  560.       X2              =   3120
  561.       Y1              =   2760
  562.       Y2              =   2760
  563.    End
  564.    Begin VB.Line Line5 
  565.       X1              =   3360
  566.       X2              =   7200
  567.       Y1              =   2520
  568.       Y2              =   2520
  569.    End
  570. Attribute VB_Name = "MatrixForm"
  571. Attribute VB_GlobalNameSpace = False
  572. Attribute VB_Creatable = False
  573. Attribute VB_PredeclaredId = True
  574. Attribute VB_Exposed = False
  575. Dim bObject As Boolean
  576. Dim bMode As Boolean
  577. Dim objVertex As Object
  578. Dim objarrMatrix(99) As Object
  579. Dim indMatrix As Long
  580. Dim varMatrix As Variant
  581. Dim dblMatrix(3, 3) As Double
  582. Private Sub btCreate_Click()
  583.     Dim strMatrix As String
  584.     On Error GoTo ErrorHandler
  585.     If (bObject = True) Then
  586.         indMatrix = indMatrix + 1
  587.         If (bMode = True) Then
  588.             strMatrix = "In-proc matrix"
  589.             Set objarrMatrix(indMatrix) = CreateObject("IMSIGX.Matrix.4")
  590.         Else
  591.             strMatrix = "Local matrix"
  592.             Set objarrMatrix(indMatrix) = CreateObject("TurboCad.Matrix.4")
  593.         End If
  594.            strMatrix = strMatrix + Str(indMatrix)
  595.            cbMatrix.AddItem strMatrix
  596.            cbMatrix.Text = cbMatrix.List(indMatrix)
  597.             btDuplicate.Enabled = True
  598.     Else
  599.         If (bMode = True) Then
  600.             Set objVertex = CreateObject("IMSIGX.Vertex.4")
  601.         Else
  602.             Set objVertex = CreateObject("TurboCad.Vertex.4")
  603.         End If
  604.         btCreate.Enabled = False
  605.         btDuplicate.Enabled = False
  606.         btDelete.Enabled = True
  607.     End If
  608.     Exit Sub
  609. ErrorHandler:
  610.     MsgBox Error(Err.Number)
  611. End Sub
  612. Private Sub btDelete_Click()
  613.     On Error GoTo ErrorHandler
  614.     If (bObject = False) Then
  615.         objVertex.Delete
  616.         btDelete.Enabled = False
  617.         btCreate.Enabled = True
  618.     Else
  619.         If (ind < atrix >= 0) Then
  620.             objarrMatrix(indMatrix).Delete
  621.             If (indMatrix > cbMatrix.ListCount) Then
  622.                 indMatrix = indMatrix - 1
  623.             End If
  624.         End If
  625.     End If
  626.     Exit Sub
  627. ErrorHandler:
  628.     MsgBox Error(Err.Number)
  629. End Sub
  630. Private Sub btDuplicate_Click()
  631.     Dim indNewMatrix As Long
  632.     Dim strMatrix As String
  633.     On Error GoTo ErrorHandler
  634.     If (bObject = True) Then
  635.         indNewMatrix = cbMatrix.ListCount
  636.         If (indMatrix > 99) Then
  637.             Error 9
  638.         Else
  639.             Set objarrMatrix(indNewMatrix) = objarrMatrix(indMatrix).Duplicate
  640.             strMatrix = cbMatrix.Text + Str(indNewMatrix)
  641.             cbMatrix.AddItem strMatrix
  642.             cbMatrix.Text = cbMatrix.List(indNewMatrix)
  643.         End If
  644.     Else
  645.         MsgBox "Don't duplicate Vertex !"
  646.     End If
  647.     Exit Sub
  648. ErrorHandler:
  649.     MsgBox Error(Err.Number)
  650. End Sub
  651. Private Sub btExit_Click()
  652.     On Error Resume Next
  653.     objVertex.Delete
  654.     End
  655. End Sub
  656. Private Sub btGet_Click()
  657.     Dim i As Integer
  658.     Dim j As Integer
  659.     On Error GoTo ErrorHandler
  660.     If (indMatrix < 0) Then Error 424
  661.     For i = 0 To 3 Step 1
  662.         For j = 0 To 3 Step 1
  663.             dblMatrix(i, j) = 0
  664.         Next j
  665.     Next i
  666.     varMatrix = dblMatrix
  667.     objarrMatrix(indMatrix).GetArray varMatrix
  668.     matrix_00.Text = varMatrix(0, 0)
  669.     matrix_01.Text = varMatrix(0, 1)
  670.     matrix_02.Text = varMatrix(0, 2)
  671.     matrix_03.Text = varMatrix(0, 3)
  672.     matrix_10.Text = varMatrix(1, 0)
  673.     matrix_11.Text = varMatrix(1, 1)
  674.     matrix_12.Text = varMatrix(1, 2)
  675.     matrix_13.Text = varMatrix(1, 3)
  676.     matrix_20.Text = varMatrix(2, 0)
  677.     matrix_21.Text = varMatrix(2, 1)
  678.     matrix_22.Text = varMatrix(2, 2)
  679.     matrix_23.Text = varMatrix(2, 3)
  680.     matrix_30.Text = varMatrix(3, 0)
  681.     matrix_31.Text = varMatrix(3, 1)
  682.     matrix_32.Text = varMatrix(3, 2)
  683.     matrix_33.Text = varMatrix(3, 3)
  684.     Exit Sub
  685. ErrorHandler:
  686.     MsgBox Error(Err.Number)
  687. End Sub
  688. Private Sub btScaleAndRotate_Click()
  689.     Dim X As Double
  690.     Dim Y As Double
  691.     Dim Z As Double
  692.     Dim XScale As Double
  693.     Dim YScale As Double
  694.     Dim ZScale As Double
  695.     Dim Angle As Double
  696.     Dim varVertex As Variant
  697.     On Error GoTo ErrorHandler
  698.     If (indMatrix < 0) Then Error 424
  699.     X = Val(valVertexX.Text)
  700.     Y = Val(valVertexY.Text)
  701.     Z = Val(valVertexZ.Text)
  702.     objVertex.X = X
  703.     objVertex.Y = Y
  704.     objVertex.Z = Z
  705.     Set varVertex = objVertex
  706.     XScale = Val(valScaleX.Text)
  707.     YScale = Val(valScaleY.Text)
  708.     ZScale = Val(valScaleZ.Text)
  709.     X = Val(valRotX.Text)
  710.     Y = Val(valRotY.Text)
  711.     Z = Val(valRotZ.Text)
  712.     Angle = Val(valAngle.Text)
  713.     objarrMatrix(indMatrix).TranslateScaleAndRotateZ X, Y, Z, XScale, YScale, ZScale, Angle, varVertex
  714.     Exit Sub
  715. ErrorHandler:
  716.     MsgBox Error(Err.Number)
  717. End Sub
  718. Private Sub btSet_Click()
  719.     On Error GoTo ErrorHandler
  720.     If (indMatrix < 0) Then Error 424
  721.     dblMatrix(0, 0) = Val(matrix_00.Text)
  722.     dblMatrix(0, 1) = Val(matrix_01.Text)
  723.     dblMatrix(0, 2) = Val(matrix_02.Text)
  724.     dblMatrix(0, 3) = Val(matrix_03.Text)
  725.     dblMatrix(1, 0) = Val(matrix_10.Text)
  726.     dblMatrix(1, 1) = Val(matrix_11.Text)
  727.     dblMatrix(1, 2) = Val(matrix_12.Text)
  728.     dblMatrix(1, 3) = Val(matrix_13.Text)
  729.     dblMatrix(2, 0) = Val(matrix_20.Text)
  730.     dblMatrix(2, 1) = Val(matrix_21.Text)
  731.     dblMatrix(2, 2) = Val(matrix_22.Text)
  732.     dblMatrix(2, 3) = Val(matrix_23.Text)
  733.     dblMatrix(3, 0) = Val(matrix_30.Text)
  734.     dblMatrix(3, 1) = Val(matrix_31.Text)
  735.     dblMatrix(3, 2) = Val(matrix_32.Text)
  736.     dblMatrix(3, 3) = Val(matrix_33.Text)
  737.     varMatrix = dblMatrix
  738.     objarrMatrix(indMatrix).SetArray varMatrix
  739.     Exit Sub
  740. ErrorHandler:
  741.     MsgBox Error(Err.Number)
  742. End Sub
  743. Private Sub cbMatrix_Click()
  744.     indMatrix = cbMatrix.ListIndex
  745. End Sub
  746. Private Sub Form_Load()
  747.     bObject = True
  748.     bMode = True
  749.     indMatrix = -1
  750. End Sub
  751. Private Sub Identity_Click(Index As Integer)
  752.     On Error GoTo ErrorHandler
  753.     If (indMatrix < 0) Then Error 424
  754.     objarrMatrix(indMatrix).Identity
  755.     Exit Sub
  756. ErrorHandler:
  757.     MsgBox Error(Err.Number)
  758. End Sub
  759. Private Sub Invert_Click(Index As Integer)
  760.     On Error GoTo ErrorHandler
  761.     If (indMatrix < 0) Then Error 424
  762.     objarrMatrix(indMatrix).Invert
  763.     Exit Sub
  764. ErrorHandler:
  765.     MsgBox Error(Err.Number)
  766. End Sub
  767. Private Sub optInproc_Click()
  768.     bMode = True 'In-proc server
  769.     optLocal.Value = False
  770. End Sub
  771. Private Sub optLocal_Click()
  772.     bMode = False 'Local server
  773.     optInproc.Value = False
  774. End Sub
  775. Private Sub optMatrix_Click()
  776.     bObject = True ' Create matrix object
  777.     optVertex.Value = False
  778.     btCreate.Enabled = True
  779.     btDelete.Enabled = False
  780.     If (indMatrix >= 0) Then
  781.         btDuplicate.Enabled = True
  782.     Else
  783.         btDuplicate.Enabled = False
  784.     End If
  785. End Sub
  786. Private Sub optVertex_Click()
  787.     Dim hVertex As Long
  788.     bObject = False 'Create vertex object
  789.     optMatrix.Value = False
  790.     btDuplicate.Enabled = False
  791.     On Error GoTo ErrorHandler
  792.     hVertex = objVertex.GetHandle()
  793. VertexExist:
  794.     btCreate.Enabled = False
  795.     btDelete.Enabled = True
  796.     Exit Sub
  797. ErrorHandler:
  798.     If (Err.Number <> 438) Then
  799.         btDelete.Enabled = False
  800.         btCreate.Enabled = True
  801.     Else
  802.         GoTo VertexExist
  803.     End If
  804. End Sub
  805. Private Sub Rotate_Click(Index As Integer)
  806.     Dim X As Double
  807.     Dim Y As Double
  808.     Dim Z As Double
  809.     Dim Angle As Double
  810.     Dim varConcat As Variant
  811.     Dim varVertex As Variant
  812.     Dim bConcat As Boolean
  813.     On Error GoTo ErrorHandler
  814.     If (indMatrix < 0) Then Error 424
  815.     X = Val(valVertexX.Text)
  816.     Y = Val(valVertexY.Text)
  817.     Z = Val(valVertexZ.Text)
  818.     objVertex.X = X
  819.     objVertex.Y = Y
  820.     objVertex.Z = Z
  821.     Set varVertex = objVertex
  822.     X = Val(valRotX.Text)
  823.     Y = Val(valRotY.Text)
  824.     Z = Val(valRotZ.Text)
  825.     Angle = Val(valAngle.Text)
  826.     bConcat = Val(valFlag)
  827.     varConcat = bConcat
  828.     objarrMatrix(indMatrix).Rotate X, Y, Z, Angle, varVertex, varConcat
  829.     Exit Sub
  830. ErrorHandler:
  831.     MsgBox Error(Err.Number)
  832. End Sub
  833. Private Sub Scale_Click(Index As Integer)
  834.     Dim hResult As Long
  835.     Dim X As Double
  836.     Dim Y As Double
  837.     Dim Z As Double
  838.        
  839.     Dim varConcat As Variant
  840.     Dim varVertex As Variant
  841.     Dim bConcat As Boolean
  842.     On Error GoTo ErrorHandler
  843.     If (indMatrix < 0) Then Error 424
  844.     X = Val(valVertexX.Text)
  845.     Y = Val(valVertexY.Text)
  846.     Z = Val(valVertexZ.Text)
  847.     objVertex.X = X
  848.     objVertex.Y = Y
  849.     objVertex.Z = Z
  850.     Set varVertex = objVertex
  851.     X = Val(valScaleX.Text)
  852.     Y = Val(valScaleY.Text)
  853.     Z = Val(valScaleZ.Text)
  854.     bConcat = Val(valFlag)
  855.     varConcat = bConcat
  856.     hResult = objarrMatrix(indMatrix).Scale(X, Y, Z, varVertex, varConcat)
  857.     Exit Sub
  858. ErrorHandler:
  859.     MsgBox Error(Err.Number)
  860. End Sub
  861. Private Sub Translate_Click(Index As Integer)
  862.     Dim X As Double
  863.     Dim Y As Double
  864.     Dim Z As Double
  865.     Dim varConcat As Variant
  866.     Dim varVetrex As Variant
  867.     Dim bConcat As Boolean
  868.     On Error GoTo ErrorHandler
  869.     If (indMatrix < 0) Then Error 424
  870.     X = Val(valVertexX.Text)
  871.     Y = Val(valVertexY.Text)
  872.     Z = Val(valVertexZ.Text)
  873.     bConcat = Val(valFlag)
  874.     varConcat = bConcat
  875.     objarrMatrix(indMatrix).Translate X, Y, Z, varConcat
  876.     Exit Sub
  877. ErrorHandler:
  878.     MsgBox Error(Err.Number)
  879. End Sub
  880. Private Sub Transpose_Click(Index As Integer)
  881.     On Error GoTo ErrorHandler
  882.     If (indMatrix < 0) Then Error 424
  883.     objarrMatrix(indMatrix).Transpose
  884.     Exit Sub
  885. ErrorHandler:
  886.     MsgBox Error(Err.Number)
  887. End Sub
  888.